/* Copyright (c) 2006, 2009, Carl Burch. License information is located in the
 * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */
 
package com.cburch.draw.undo;

class ActionUnion extends Action {
    Action first;
    Action second;

    /**
     * Set the two <code>Action</code> objects.
     * @param first <code>Action</code>
     * @param second <code>Action</code>
     */
    ActionUnion(Action first, Action second) {
        this.first = first;
        this.second = second;
    }

    /**
     * Not used.
     * Indicates if either <code>Action</code> is a modification.
     */
    public boolean isModification() {
        return first.isModification() || second.isModification();
    }

    /**
     * Returns the name of the first <code>Action</code>.
     * @return <code>String</code> name
     */
    public String getName() { return first.getName(); }

    /**
     * Performs the first <code>Action</code> and the second <code>Action</code>.
     * @param proj <code>Project</code> to perform the <code>Action</code> on
     */
    public void doIt() {
        first.doIt();
        second.doIt();
    }

    /**
     * Performs the undo action for both <code>Action</code> objects.
     * @param proj <code>Project</code> to undo the <code>Action</code> on
     */
    public void undo() {
        second.undo();
        first.undo();
    }
}
